<template>
  <div class="main-container-app">
    <el-row class="form-contain">
      <re-coll-form @handleQueryReColl="handleQueryReColl"></re-coll-form>
    </el-row>
    <div class="table-contain">
      <data-re-table :searchList="dataReRes" :listLoadingDataRe="loading"
                     @handleCurrentChangeDataRe="handleCurrentChangeDataRe"
                     @handleSizeChangeDataRe="handleSizeChangeDataRe"></data-re-table>
    </div>
  </div>

</template>

<script>
  /* eslint-disable */
  import DataReTable from "./reCollChild/dataReTable";
  import ReCollForm from "./reCollChild/reCollForm";
  import {fetchListDataRe} from "../../api/recoll/dataRe";

  export default {
    components: {
      ReCollForm,
      DataReTable
    },
    data() {
      return {
        dataReRes: null,
        loading: false,
        queryData: '',
        listQuery: {
          page: 1,
          limit: 20
        }

      }
    },
    methods: {
      handleQueryReColl(val) {
        this.queryData = val
        this.listQuery.page = 1
        this.listQuery.limit = 20
        this.getDataListDataRe()
      },
      handleCurrentChangeDataRe(val) {
        this.listQuery.page = val
        this.getDataListDataRe()
      },
      handleSizeChangeDataRe(val) {
        this.listQuery.limit = val
        this.listQuery.page = 1
        this.getDataListDataRe()
      },
      getDataListDataRe() {
        this.loading = true
        fetchListDataRe(this.listQuery, this.queryData).then(res => {
            console.log(res)
            this.dataReRes = res
            this.loading = false
          },
          () => {
            this.loading = false
          })
      }
    }
  }
</script>

<style scoped>

</style>

